﻿<%@ Page Title="Your Outstanding Task" Language="C#" MasterPageFile="~/eTransmittal.Master" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="POI.eTransmittal.WebApp.Main" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxRoundPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Xpo.v11.2.Web, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Xpo" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxHiddenField" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxCallback" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
    <table style="width:100%;">
    <tr>
        <td align="center">
            <dx:ASPxRoundPanel ID="roundPanelIncoming" runat="server" 
                ClientInstanceName="roundPanelIncoming" 
                HeaderText="Outstanding Incoming Transmittal" Width="90%">
                <HeaderStyle HorizontalAlign="Left" />
                <HeaderTemplate>
                <table width="100%"><tr><td align="left">Incoming Transmittal</td><td align="right">
                    <dx:ASPxHyperLink ID="linkHincoming" ClientInstanceName="linkHincoming" 
                        NavigateUrl="javascript:void(0)" runat="server" Text="Hide" 
                        Font-Underline="False">
                        <ClientSideEvents Click="function(s, e) {
	togglePnl('divIncoming',s)
}" />
                    </dx:ASPxHyperLink>
                </td></tr></table>
                    
                </HeaderTemplate>
                <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
<div id="divIncoming" style="display:block">
    <table style="width:100%;">
        <tr>
            <td>
                <dx:ASPxGridView ID="grdOutstandingIncoming" runat="server" 
                    AutoGenerateColumns="False" ClientInstanceName="grdOutstandingIncoming" 
                    DataSourceID="xpodsOutstandingIncoming" KeyFieldName="ID" Width="100%" 
                    OnCustomCallback="grdOutstandingIncoming_CustomCallback">
                    <ClientSideEvents CustomButtonClick="function(s, e) {
	onEditIncoming(s,e);
}" />
<ClientSideEvents CustomButtonClick="function(s, e) {
	onEditIncoming(s,e);
}"></ClientSideEvents>
                    <Columns>
                        <dx:GridViewDataTextColumn FieldName="Subject" ShowInCustomizationForm="True" 
                            VisibleIndex="2">
                            <PropertiesTextEdit DisplayFormatString="{0}">
                            </PropertiesTextEdit>
                            <CellStyle HorizontalAlign="Left">
                            </CellStyle>                            
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="From" ShowInCustomizationForm="True" 
                            VisibleIndex="3" Width="100px">
                            <CellStyle HorizontalAlign="Left">
                            </CellStyle>
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="No." FieldName="ID" 
                            ShowInCustomizationForm="True" VisibleIndex="0">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Status" ShowInCustomizationForm="True" 
                            VisibleIndex="5">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataDateColumn FieldName="ReceivedDate" 
                            ShowInCustomizationForm="True" VisibleIndex="1" Width="150px">
                            <PropertiesDateEdit DisplayFormatString="dd MMM yyyy  HH:mm:ss">
                            </PropertiesDateEdit>
                        </dx:GridViewDataDateColumn>
                        <dx:GridViewDataTextColumn FieldName="AttnNames" ShowInCustomizationForm="True" 
                            VisibleIndex="4" Width="200px" Caption="Attn">
                            <CellStyle HorizontalAlign="Left">
                            </CellStyle>
                        </dx:GridViewDataTextColumn>                        
                        <dx:GridViewCommandColumn Caption=" " ShowInCustomizationForm="True" 
                            VisibleIndex="6" Width="10px">
                            <ClearFilterButton Visible="True">
                            </ClearFilterButton>
                            <CustomButtons>
                                <dx:GridViewCommandColumnCustomButton ID="btnPopupView" Text="View">
                                </dx:GridViewCommandColumnCustomButton>
                            </CustomButtons>
                        </dx:GridViewCommandColumn>
                    </Columns>
                </dx:ASPxGridView>
            </td>
        </tr>
        <tr>
            <td align="right">
                <dx:ASPxButton ID="btnRegisterIncoming" runat="server" 
                    ClientInstanceName="btnRegisterIncoming" 
                    Text="Register New Incoming Transmittal" Width="300px" 
                    AutoPostBack="False">
                    <ClientSideEvents Click="function(s, e) {
	GotoNewIncoming();
}" />

                </dx:ASPxButton>
            </td>
        </tr>
    </table>
    </div>
                    </dx:PanelContent>
</PanelCollection>
            </dx:ASPxRoundPanel>
        </td>
    </tr>
    <tr>
        <td align="center">
            <dx:ASPxRoundPanel ID="roundPanelOutgoing" runat="server" 
                ClientInstanceName="roundPanelOutgoing" 
                HeaderText="Outstanding Outgoing Transmittal" Width="90%">
                <HeaderStyle HorizontalAlign="Left" />
               <HeaderTemplate>
                <table width="100%"><tr><td align="left">Outgoing Transmittal</td><td align="right">
                    <dx:ASPxHyperLink ID="linkColOutgoing" ClientInstanceName="linkColOutgoing" 
                        NavigateUrl="javascript:void(0)" runat="server" Text="Hide" 
                        Font-Underline="False">
                        <ClientSideEvents Click="function(s, e) {
	togglePnl('divOutgoing',s);
}" />
                    </dx:ASPxHyperLink>
                </td></tr></table>
                    
                </HeaderTemplate>
                <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
<div id="divOutgoing" style="display:block">
    <table style="width:100%;">
        <tr>
            <td align="left">
                <dx:ASPxGridView ID="grdOutstandingTransmittal" runat="server" 
                    AutoGenerateColumns="False" ClientInstanceName="grdOutstandingTransmittal" 
                    DataSourceID="xpodsOutstandingOutgoing" KeyFieldName="ID" Width="100%" 
                    OnCustomCallback="grdOutstandingTransmittal_CustomCallback">
                    <ClientSideEvents CustomButtonClick="function(s, e) {
	onEditOutgoing(s,e);
}" />
                    <Columns>
                        <dx:GridViewDataTextColumn FieldName="Subject" ShowInCustomizationForm="True" 
                            VisibleIndex="2">                        
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Author" ShowInCustomizationForm="True" 
                            VisibleIndex="3" Width="100px">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="FaxNo" ShowInCustomizationForm="True" 
                            VisibleIndex="4" Width="100px">
                            <CellStyle HorizontalAlign="Center">
                            </CellStyle>
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Attn" ShowInCustomizationForm="True" 
                            VisibleIndex="5" Width="100px">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="No" ShowInCustomizationForm="True" 
                            VisibleIndex="0">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Status" ShowInCustomizationForm="True" 
                            VisibleIndex="6">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataDateColumn FieldName="CreatedDate" 
                            ShowInCustomizationForm="True" VisibleIndex="1" Width="150px">
                            <PropertiesDateEdit DisplayFormatString="dd MMM yyyy  HH:mm:ss">
                            </PropertiesDateEdit>
                            <CellStyle HorizontalAlign="Center">
                            </CellStyle>
                        </dx:GridViewDataDateColumn>
                        <dx:GridViewCommandColumn Caption=" " ShowInCustomizationForm="True" 
                            VisibleIndex="7" Width="10px">
                            <ClearFilterButton Visible="True">
                            </ClearFilterButton>
                            <CustomButtons>
                                <dx:GridViewCommandColumnCustomButton ID="btnPopupViewOutgoing" Text="View">
                                </dx:GridViewCommandColumnCustomButton>
                            </CustomButtons>
                        </dx:GridViewCommandColumn>
                    </Columns>
                </dx:ASPxGridView>
            </td>
        </tr>
        <tr>
            <td align="right">
                <dx:ASPxButton ID="btnRegisterOutgoing" runat="server" AutoPostBack="False" 
                    ClientInstanceName="btnRegisterOutgoing" 
                    Text="Register New Outgoing Transmittal" Width="300px">
                    <ClientSideEvents Click="function(s, e) {
	GotoNewOutgoing();
}" />
                </dx:ASPxButton>
            </td>
        </tr>
    </table>
    </div>
                    </dx:PanelContent>
</PanelCollection>
            </dx:ASPxRoundPanel>
        </td>
    </tr>
    <tr>
        <td>
            <dx:XpoDataSource ID="xpodsOutstandingIncoming" runat="server" 
                TypeName="POI.eTransmittal.Enitity.IncomingTransmittal">
            </dx:XpoDataSource>
            <dx:XpoDataSource ID="xpodsOutstandingOutgoing" runat="server" 
                TypeName="POI.eTransmittal.Enitity.OutgoingTransmittal">
            </dx:XpoDataSource>
                <dx:XpoDataSource ID="xpoDsInbox" runat="server" TypeName="POI.eTransmittal.Enitity.Inbox">
                </dx:XpoDataSource>
                <dx:XpoDataSource ID="xpodsTransUser" runat="server" 
                    TypeName="POI.eTransmittal.Enitity.TransmittalUser">
                </dx:XpoDataSource>
    <dx:XpoDataSource ID="xpoDsContact" runat="server" 
        TypeName="POI.eTransmittal.Enitity.Contact">
    </dx:XpoDataSource>
    <dx:XpoDataSource ID="xpodsDocType" runat="server" 
        TypeName="POI.eTransmittal.Enitity.DocumentType">
    </dx:XpoDataSource>
    <dx:XpoDataSource ID="xpodsUser" runat="server" 
        TypeName="POI.eTransmittal.Enitity.TransmittalUser">
    </dx:XpoDataSource>
    <dx:ASPxCallback ID="clbCancel" runat="server" ClientInstanceName="clbCancel" 
        oncallback="clbCancel_Callback">
        <ClientSideEvents CallbackComplete="function(s, e) {
	OnUploadCanceledOutgoing(e);
}" />
    </dx:ASPxCallback>
                <dx:ASPxCallback ID="clbCancelIncoming" runat="server" ClientInstanceName="clbCancelIncoming" 
                    oncallback="clbCancelIncoming_Callback">
                    <ClientSideEvents CallbackComplete="function(s, e) {
	OnUploadCanceledIncoming(e);
}" />
                </dx:ASPxCallback>
            <dx:ASPxPopupControl ID="popUser" 
        runat="server" HeaderText="Select User" Width="300px" 
        PopupHorizontalAlign="RightSides" PopupVerticalAlign="Below" 
                ClientInstanceName="popUser" AllowDragging="True" 
                RenderIFrameForPopupElements="True" MaxWidth="300px" MinHeight="50px" 
                MinWidth="300px">
                                            <ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl2" runat="server" SupportsDisabledAttribute="True">
<table width="100%"><tr><td>
    <dx:ASPxGridView ID="grdEmployee" runat="server" AutoGenerateColumns="False" 
        Width="100%" ClientInstanceName="grdEmployee" 
        OnCustomCallback="grdEmployee_CustomCallback" 
        DataSourceID="xpodsTransUser" KeyFieldName="UserID">
        <ClientSideEvents EndCallback="function(s, e) 
{
	selectEmployeeOnGrid();
}" />
        <Columns>
            <dx:GridViewCommandColumn Caption=" " ShowInCustomizationForm="True" 
                VisibleIndex="0" ShowSelectCheckbox="True" Width="15px">
            </dx:GridViewCommandColumn>
            <dx:GridViewDataTextColumn FieldName="Name" ShowInCustomizationForm="True" 
                VisibleIndex="2">
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsPager PageSize="5" NumericButtonCount="1">
        </SettingsPager>
        <Settings ShowFilterRow="True" />
    </dx:ASPxGridView></td></tr>
      
            <tr>
                <td>
                    
                    <dx:ASPxButton ID="btnuserSave" runat="server" AutoPostBack="False" Text="Ok" 
                        Width="100%">
                        <ClientSideEvents Click="function(s, e) {
	OnSelectEmployeeDone();
}" />
                    </dx:ASPxButton>
                    
                </td>
            </tr>
     
    </table>
   
  
    
    
                                                </dx:PopupControlContentControl>
</ContentCollection>
    </dx:ASPxPopupControl><dx:ASPxPopupControl ID="popEditIncoming" runat="server" Width="900px" HeaderText="Edit Transmittal"
                    ClientInstanceName="popEditIncoming" PopupHorizontalAlign="WindowCenter" 
                    PopupVerticalAlign="WindowCenter" Modal="True" AllowDragging="True" 
                    Height="600px">
                    <ClientSideEvents Shown="function(s, e) {
	clbPanelEdit.PerformCallback('load;' + transIDtoShow);
}" />
<ClientSideEvents Shown="function(s, e) {
	clbPanelEdit.PerformCallback(&#39;load;&#39; + transIDtoShow);
}"></ClientSideEvents>
                    <ContentCollection>
                        <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                            
                            <table style="width:100%;">
                            <tr>
                                <td><dx:ASPxCallbackPanel ID="clbPanelEdit" runat="server" Width="100%" 
                                ClientInstanceName="clbPanelEdit" OnCallback="clbPanelEdit_Callback">

<ClientSideEvents EndCallback="function(s, e) {
	handlePopEditInfoIncoming();
}"></ClientSideEvents>
                                <PanelCollection>
<dx:PanelContent ID="PanelContent1" runat="server">
<table width="100%">
                                <tr>
                                    <td valign="top">
                                    <table width="100%" style="height: 100%">
                                            <tr>
                                                <td width="60px">
                                                    Subject
                                                </td>
                                                <td colspan="3" bgcolor="#CCCCCC">
                                                    <dx:ASPxTextBox ID="txtPopSubject" runat="server" Width="100%" ClientInstanceName="txtPopSubject">
                                                    </dx:ASPxTextBox>
                                                </td>
                                                 <td>
                                                     &nbsp;</td>
                                                <td>
                                                    No
                                                </td>
                                                <td bgcolor="#CCCCCC" style="padding-left: 5px">
                                                    <dx:ASPxLabel ID="lblPopNo" runat="server" Text="(auto generated)">
                                                    </dx:ASPxLabel>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="100px">
                                                    Received Date
                                                </td>
                                                <td bgcolor="#CCCCCC">
                                                    <dx:ASPxDateEdit ID="dtePopReceivedDate" runat="server" 
                                                        ClientInstanceName="dteReceivedDate" DisplayFormatString="dd MMM yyyy  HH:mm:ss" 
                                                        EditFormat="Custom" EditFormatString="dd MMM yyyy  HH:mm:ss" 
                                                        UseMaskBehavior="True">
                                                    </dx:ASPxDateEdit>
                                                </td>
                                                <td>
                                                    &nbsp;</td>
                                                <td>
                                                    &nbsp;</td>
                                                  <td>
                                                      &nbsp;</td>
                                                <td width="50px">
                                                    Attn
                                                </td>
                                                <td bgcolor="#CCCCCC">
                                                    <dx:ASPxButtonEdit ID="btePopAttn" runat="server" Width="100%" 
                                                        ClientInstanceName="btePopAttn">
                                                        <ClientSideEvents ButtonClick="function(s, e) {
	ShowSelectEmployee(s, 'Attn');
}" />
                                                        <Buttons>
                                                            <dx:EditButton>
                                                            </dx:EditButton>
                                                        </Buttons>
                                                    </dx:ASPxButtonEdit>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Inbox
                                                </td>
                                                <td width="90px" bgcolor="#CCCCCC">
                                                    <dx:ASPxComboBox ID="cboPopInbox" runat="server" DataSourceID="xpodsInbox" 
                                                        TextField="Name" ValueField="Name" ClientInstanceName="cboPopInbox">
                                                    </dx:ASPxComboBox>
                                                </td>
                                                <td width="48px">
                                                    From </td>
                                                <td width="90px" bgcolor="#CCCCCC">
                                                    <dx:ASPxComboBox ID="cboPopFrom" runat="server" ClientInstanceName="cboPopFrom" 
                                                        DataSourceID="xpoDsContact" TextField="Name" ValueField="ID">
                                                    </dx:ASPxComboBox>
                                                </td>
                                                <td width="42px">
                                                    &nbsp;</td>
                                                <td>
                                                    Cc
                                                </td>
                                                <td bgcolor="#CCCCCC">
                                                    <dx:ASPxButtonEdit ID="btePopCc" runat="server" Width="100%" 
                                                        ClientInstanceName="btePopCc">
                                                        <ClientSideEvents ButtonClick="function(s, e) {
	ShowSelectEmployee(s, 'Cc');
}" />
                                                        <Buttons>
                                                            <dx:EditButton>
                                                            </dx:EditButton>
                                                        </Buttons>
                                                    </dx:ASPxButtonEdit>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="27px" valign="top">
                                                    Remarks
                                                </td>
                                                <td colspan="3" height="27px" valign="top" bgcolor="#CCCCCC">
                                                    <dx:ASPxTextBox ID="txtPopRemarks" runat="server" Width="100%">
                                                    </dx:ASPxTextBox>
                                                </td>
                                                 <td valign="top">
                                                     &nbsp;</td>
                                                <td>
                                                    Doc
                                                </td>
                                                <td width="320" bgcolor="#CCCCCC">
                                                    <table cellpadding="0" cellspacing="0" style="width:100%;">
                                                        <tr>
                                                            <td valign="top" align="center">
                                                                <dx:ASPxButton ID="btnChangeIncoming" runat="server" AutoPostBack="False" 
                                                                    ClientInstanceName="btnChangeIncoming" Width="280px">
                                                                    <ClientSideEvents Click="function(s, e) {
if(s.GetText() != 'Cancel')
{
	s.SetText('Cancel');
	toggleUploadIncoming('change');
	//lblFile.SetClientVisible(false);	
}
else
{
	//s.SetText('Change File');
	clbCancelIncoming.PerformCallback(transIDtoShow);
	//lblFile.SetClientVisible(true);
}
}" />
                                                                </dx:ASPxButton>
                                                                <dx:ASPxUploadControl ID="upcPopDoc" runat="server" 
                                                                    ClientInstanceName="upcPopDoc" ClientVisible="False" 
                                                                    OnFileUploadComplete="upcPopDoc_FileUploadComplete1" 
                                                                    ShowClearFileSelectionButton="False" ShowUploadButton="True" Width="280px">
                                                                    <ValidationSettings MultiSelectionErrorText="Attention! 

The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

{2}">
                                                                    </ValidationSettings>
                                                                    <ClientSideEvents FileUploadComplete="function(s, e) {
	onUploadCompleteIncoming(e);
}" />
                                                                </dx:ASPxUploadControl>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                    
                                                  
                                                    
                                                </td>
                                            </tr>
                                        </table>
                                       
                                    </td>
                                   
                                </tr>
                                <tr>
                                    <td align="right">
                                        &nbsp;</td>
                                </tr>
                                
                                <tr>
                                    <td align="right" bgcolor="#999999">
                                        <table>
                                            <tr>
                                                <td>
                                                    <dx:ASPxButton ID="btnDistribute" runat="server" AutoPostBack="False" 
                                                        Text="Send">
                                                        <ClientSideEvents Click="function(s, e) {
	onPopDistribute();
}" />
                                                    </dx:ASPxButton>
                                                </td>
                                                <td>
                                                    <dx:ASPxButton ID="btnSave" runat="server" AutoPostBack="False" Text="Save">
                                                        <ClientSideEvents Click="function(s, e) {
	onPopSave();
}" />
                                                    </dx:ASPxButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                
                            </table>
                              <dx:ASPxHiddenField ID="hfField" runat="server" 
        ClientInstanceName="hfField" OnCustomCallback="hfField_CustomCallback">
                                                    <ClientSideEvents EndCallback="function(s, e) {
	OnLinkIncomingUpdated(s,e);
}" />
                                                    </dx:ASPxHiddenField>   
                                    </dx:PanelContent>
</PanelCollection>
                            </dx:ASPxCallbackPanel></td>
                            </tr>
                            <tr>
                                <td><iframe id="frDoc" width="100%" height="400" style="z-index: 0" ></iframe></td>
                            </tr>
                            </table>
                        </dx:PopupControlContentControl>
                    </ContentCollection>
                </dx:ASPxPopupControl>
            <dx:ASPxPopupControl ID="popEditOutgoing" runat="server" Width="800px" 
        ClientInstanceName="popEditOutgoing" HeaderText="Edit Outgoing Transmittal" 
        Modal="True" PopupHorizontalAlign="WindowCenter" 
        PopupVerticalAlign="WindowCenter" AllowDragging="True" Height="600px">
        <ClientSideEvents Shown="function(s, e) {
	clbpnlPopEdit.PerformCallback('load;'+transIDtoShow.toString());
}" />
        <ContentCollection>
<dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True">
    
     <table width="100%">
     <tr>
     <td>
     <dx:ASPxCallbackPanel ID="clbpnlPopEdit" runat="server" Width="100%" 
        OnCallback="clbpnlPopEdit_Callback" ClientInstanceName="clbpnlPopEdit">
        <ClientSideEvents CallbackError="function(s, e) {

}" EndCallback="function(s, e) {
	handlePopEditInfoOutgoing();
}" />
        <PanelCollection>
            <dx:PanelContent ID="PanelContent2" runat="server" SupportsDisabledAttribute="True">
<table width="100%">
    <tr>
        <td>
            Subject</td>
        <td valign="top" bgcolor="#CCCCCC" width="300">
            <dx:ASPxTextBox ID="txtEditSubject" runat="server" 
                ClientInstanceName="txtEditSubject" Width="100%">
            </dx:ASPxTextBox>
        </td>
        <td>
            </td>
        <td>
            Log No.</td>
        <td bgcolor="#CCCCCC" style="padding-left: 5px">
            <dx:ASPxLabel ID="lblLog" runat="server" ClientInstanceName="lblNo" 
                Text="(auto generated)">
            </dx:ASPxLabel>
        </td>
    </tr>
<tr><td>Author</td><td valign="top" bgcolor="#CCCCCC">
    <dx:ASPxComboBox ID="cboAuthor" runat="server" CallbackPageSize="10" 
        ClientInstanceName="cboAuthor" DataSourceID="xpodsUser" 
        DropDownStyle="DropDown" EnableCallbackMode="True" 
        EnableIncrementalFiltering="True" IncrementalFilteringMode="StartsWith" 
        TextField="Name" ValueField="UserID">
    </dx:ASPxComboBox>
    </td><td></td><td>Ref No.</td><td bgcolor="#CCCCCC" style="padding-left: 5px"><dx:ASPxLabel 
        ID="lblRefNo" runat="server" ClientInstanceName="lblRefNo">
    </dx:ASPxLabel>
    </td></tr>
    <tr>
        <td>
            To</td>
        <td valign="top" bgcolor="#CCCCCC">
            <dx:ASPxComboBox ID="cboEditTo" runat="server" ClientInstanceName="cboEditTo" 
                DataSourceID="xpoDsContact" DropDownStyle="DropDown" TextField="Name" 
                ValueField="Name">
            </dx:ASPxComboBox>
        </td>
        <td>
            </td>
        <td>
            Document Type</td>
        <td valign="top" bgcolor="#CCCCCC">
            <dx:ASPxComboBox ID="cboEditDocType" runat="server" 
                ClientInstanceName="cboEditDocType" DataSourceID="xpodsDocType" 
                DropDownStyle="DropDown" TextField="TypeName" ValueField="Code">
                <ClientSideEvents SelectedIndexChanged="function(s, e) {
	OnDocTypeChanged(s,e);
}" />
            </dx:ASPxComboBox>
        </td>
    </tr>
    <tr>
        <td>
            Fax No</td>
        <td valign="top" bgcolor="#CCCCCC">
            <dx:ASPxTextBox ID="txtEditFaxNo" runat="server" 
                ClientInstanceName="txtEditFaxNo" Width="170px">
            </dx:ASPxTextBox>
        </td>
        <td>
            &nbsp;</td>
        <td rowspan="1">
            File</td>
        <td rowspan="1" bgcolor="#CCCCCC" width="280">
            <table cellpadding="0" cellspacing="0" style="width:100%;">
                <tr>
                    <td align="center">
                        <dx:ASPxButton ID="btnChangeOutgoing" runat="server" AutoPostBack="False" 
                            ClientInstanceName="btnChangeOutgoing" Width="280px">
                            <ClientSideEvents Click="function(s, e) {
if(s.GetText() != 'Cancel')
{
	s.SetText('Cancel');
	toggleUploadOutgoing('change');
}
else{
	//s.SetText('Change File');
	clbCancel.PerformCallback(transIDtoShow);
}
}" />
                        </dx:ASPxButton>
                        <dx:ASPxUploadControl ID="upcDocument" runat="server" 
                            ClientInstanceName="upcDocument" ClientVisible="False" 
                            OnFileUploadComplete="upcDocument_FileUploadComplete" ShowUploadButton="True" 
                            Width="280px">
                            <ValidationSettings MultiSelectionErrorText="Attention! 

The following {0} files are invalid because they exceed the allowed file size ({1}) or their extensions are not allowed. These files have been removed from selection, so they will not be uploaded. 

{2}">
                            </ValidationSettings>
                            <ClientSideEvents FileUploadComplete="function(s, e) {
	onUploadCompleteOutgoing(e);
}" />
                        </dx:ASPxUploadControl>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            Attn</td>
        <td valign="top" bgcolor="#CCCCCC">
            <dx:ASPxTextBox ID="txtEditAttn" runat="server" 
                ClientInstanceName="txtEditAttn" Width="100%">
            </dx:ASPxTextBox>
        </td>
        <td>
            </td>
        <td valign="top">
            &nbsp;</td>
        <td bgcolor="#CCCCCC">
        </td>
    </tr>
    <tr>
        <td>
            Remarks</td>
        <td valign="top" bgcolor="#CCCCCC">
            <dx:ASPxTextBox ID="txtEditRemarks" runat="server" 
                ClientInstanceName="txtRemarks" Width="100%">
            </dx:ASPxTextBox>
        </td>
        <td>
            &nbsp;</td>
        <td>
            &nbsp;</td>
        <td bgcolor="#CCCCCC" style="padding-left: 5px">
            &nbsp;</td>
    </tr>
   
    <tr>
        <td valign="top">
            &nbsp;</td>
        <td valign="top">
            <dx:ASPxHiddenField ID="hfEdit" runat="server" ClientInstanceName="hfEdit" 
                OnCustomCallback="hfEdit_CustomCallback">
                <ClientSideEvents EndCallback="function(s, e) {
	onLinkOutgoingUpdate(s,e);
}" />
            </dx:ASPxHiddenField>
        </td>
        <td valign="top">
            &nbsp;</td>
        <td valign="top">
            &nbsp;</td>
        <td align="right" valign="top">
            &nbsp;</td>
    </tr>
    <tr align="right" valign="top">
        <td bgcolor="Gray" colspan="5" style="border-color: #CCCCCC" valign="top">
            <table>
                <tr>
                    <td>
                        <dx:ASPxButton ID="btnSendFax" runat="server" AutoPostBack="False" 
                            Text="Send Fax">
                            <ClientSideEvents Click="function(s, e) {
	clbpnlPopEdit.PerformCallback('send;'+transIDtoShow.toString());
}" />
                        </dx:ASPxButton>
                    </td>
                    <td>
                        <dx:ASPxButton ID="btnSubmit" runat="server" AutoPostBack="False" Text="Submit">
                            <ClientSideEvents Click="function(s, e) {
	clbpnlPopEdit.PerformCallback('submit;'+transIDtoShow.toString());
}" />
                        </dx:ASPxButton>
                    </td>
                    <td>
                        <dx:ASPxButton ID="ASPxButton2" runat="server" AutoPostBack="False" Text="Save">
                            <ClientSideEvents Click="function(s, e) {
	clbpnlPopEdit.PerformCallback('save;'+transIDtoShow.toString());
}" />
                        </dx:ASPxButton>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
                <%--<table width="100%">
            <tr>
                <td valign="top" style="width:350px">
                <table width="100%" style="height:150px">
                                    <tr>
                                        <td>
                                        Subject
                                        </td>
                                        <td>
                                       
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Author</td>
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            To</td>
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Fax No</td>
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Attn</td>
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Remarks</td>
                                        <td>
                                            &nbsp;</td>
                                    </tr>
                                </table>
                   
                </td>
                <td valign="top">
                <table width="100%" style="height:150px"><tr>
    <td valign="top" style="width:90px">Transmittal No.</td><td valign="top" >
                    &nbsp;</td></tr>
    <tr>
        <td valign="top">
            Document Type</td>
        <td valign="top">
            &nbsp;</td>
    </tr>
    <tr>
        <td valign="top">
            File</td>
        <td valign="top">
            &nbsp;</td>
    </tr>
    <tr>
        <td valign="top">
            &nbsp;</td>
        <td valign="top">
            &nbsp;</td>
    </tr>
    <tr>
        <td valign="top">
            Ready to send</td>
        <td valign="top">
            &nbsp;</td>
    </tr>
    <tr>
        <td valign="top">
            Status</td>
        <td valign="top">
            &nbsp;</td>
    </tr>
    </table>
                
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td align="right">
                    </td>
            </tr>
                    
        </table>--%>

            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxCallbackPanel>
     </td>
     </tr>
                            <tr>
                                <td><iframe id="frDocOutgoing" width="100%" height="400" ></iframe></td>
                            </tr>
                            </table>
            </dx:PopupControlContentControl>
</ContentCollection>
    </dx:ASPxPopupControl>
        </td>
    </tr>
</table>
<script type="text/javascript">

    function onEditOutgoing(s, e) {
        s.GetRowValues(e.visibleIndex, "ID;Subject", onGetIdCompleted);
    }
    
    var transIDtoShow = -1;
    function onGetIdCompleted(values) {
        transIDtoShow = values[0];


        popEditOutgoing.Show();
    }

    function handlePopEditInfoOutgoing() {
        var isErr = hfEdit.Get('error');
        var isinfo = hfEdit.Get('info');
        var link = hfEdit.Get('uncLink');

        if (isErr != null || isErr != undefined) {
            ShowErrorMessage(hfEdit.Get('error'));
            hfEdit.Clear();
        }
        else if (isinfo != null || isinfo != undefined) {
            ShowStatusMessage(hfEdit.Get('info'));
            popEditOutgoing.Hide();
            hfEdit.Clear();
            grdOutstandingTransmittal.PerformCallback();
        }
        else if (link != null || link != undefined) {
            var frame = document.getElementById('frDocOutgoing');
            //alert(link);
            frame.src = link;
        }


    }
    function toggleUploadOutgoing(s) {
        var text = s;
        switch (text) {
            case 'change':
                //var dv = document.getElementById('divReadDoc');
                //dv.style.display = 'none';
                upcDocument.SetClientVisible(true);
                break;
            case 'view':
                //var dv = document.getElementById('divReadDoc');
                //dv.style.display = 'block';
                upcDocument.SetClientVisible(false);


                break;


        }
    }

    function onUploadCompleteOutgoing(e) {
        toggleUploadOutgoing('view');
        btnChangeOutgoing.SetText(e.callbackData);
        hfEdit.PerformCallback();

    }
    function ClearEntryOutgoing() {
        dteStartDate.SetText('');
        dteEndDate.SetText('');
        cboTo.SetText('');
        cboStatus.SetSelectedIndex(0);
    }
    function OnDocTypeChanged(s, e) {


    }
    function OnUploadCanceledOutgoing(e) {
        btnChangeOutgoing.SetText(e.result);
        toggleUploadOutgoing('view');
        hfEdit.PerformCallback('cancel;' + transIDtoShow);
    }

    var allowExtensions = ['msg', 'pdf'];
    function OnTextChanged(uploadControl) {
        if (!isValidFileName(uploadControl.GetText())) {
            uploadControl.ClearText();
            alert("File extension isn't allowed");
        }
    }
    function isValidFileName(fileName) {
        var fileParts = fileName.split(".");
        var fileExtension = fileParts[fileParts.length - 1];
        return arrayIndexOf(allowExtensions, fileExtension) != -1;
    }
    function arrayIndexOf(array, element) {
        for (var i = 0; i < array.length; i++) {
            if (array[i] == element)
                return i;
        }
        return -1;
    }

    function onEditIncoming(s, e) {
        s.GetRowValues(e.visibleIndex, "ID;Subject", onGetIdCompletedIncoming);
    }
    //var transIDtoShow = -1;
    function onGetIdCompletedIncoming(values) {
        transIDtoShow = values[0];
        
        popEditIncoming.Show();
    }
    function onPopSave() {
        clbPanelEdit.PerformCallback('save;' + transIDtoShow);
    }
    function onPopDistribute() {
        clbPanelEdit.PerformCallback('distribute;' + transIDtoShow);
    }
    function onPopCancel() {
        popEditIncoming.Hide();
        clbPanelEdit.PerformCallback('cancel;' + transIDtoShow);
    }
    
    function handlePopEditInfoIncoming() {
        var isErr = hfField.Get('error');
        var isinfo = hfField.Get('info');
        var link = hfField.Get('uncLink');

        if (isErr != null || isErr != undefined) {
            ShowErrorMessage(hfField.Get('error'));
            hfField.Clear();
        }
        else if (isinfo != null || isinfo != undefined) {

            ShowStatusMessage(hfField.Get('info'));           
            popEditIncoming.Hide();
            hfField.Clear();
            grdOutstandingIncoming.PerformCallback();
        }
        else if (link != null || link != undefined) {

            var frame = document.getElementById('frDoc');
            //alert(link);
            frame.src = link;
        }


    }
    function OnSelectEmployee(s, e) {
        var idx = e.visibleIndex;
        s.GetRowValues(idx, "mail;Name", onGetEmployee);
    }
    var txtTowrite = '';
    var txtctr;
    var activeBteType;
    var contactSuccess = true;
    var rowsSelected = false;
    function ShowSelectEmployee(s, type, mode) 
    {
        txtctr = s;
        activeBteType = type;
        rowsSelected = false;

        grdEmployee.PerformCallback('bind;' + mode);
        popUser.ShowAtElement(s.GetMainElement());

    }
    function OnSelectEmployeeDone() 
    {
        grdEmployee.GetSelectedFieldValues('UserID;Name', OnGetValues);
    }




    function OnGetValues(results) {
        if (results.length == 0)
            return;

        var value = '';
        var names = '';
        for (i = 0; i < results.length; i++) 
        {
            value += results[i][0] + ';';

            names += names == '' ? '' : ', ';
            names += results[i][1];
        }

        txtctr.SetText(names);
        if (hfField.Contains(activeBteType))
            hfField.Set(activeBteType, value);
        else
            hfField.Add(activeBteType, value);

        popUser.Hide();

        activeBteType = '';
    }

    function toggleUploadIncoming(s) {
        var text = s;
        switch (text) {
            case 'change':
                /*var dv = document.getElementById('divReadDoc');
                dv.style.display = 'none';*/
                upcPopDoc.SetClientVisible(true);
                break;
            case 'view':
                /*var dv = document.getElementById('divReadDoc');
                dv.style.display = 'block';*/
                upcPopDoc.SetClientVisible(false);

                break;


        }
    }
    function onUploadCompleteIncoming(e) {
        toggleUploadIncoming('view');
        //lblFile.SetText(e.callbackData);
        btnChangeIncoming.SetText(e.callbackData);
        hfField.PerformCallback();
       
//        var frame = document.getElementById('frDoc');
//        //alert(link);
//        frame.src = link;
    }
    function ClearEntry() {
        dteStartDate.SetText('');
        dteEndDate.SetText('');
        cboInbox.SetText('');
        cboStatus.SetSelectedIndex(0);
        cboFrom.SetText('');
        //  gridTransmittal.PerformCallback();
        //cboFrom
    }
    function OnUploadCanceledIncoming(e) {
        //lblFile.SetText(e.result);
        btnChangeIncoming.SetText(e.result);
        toggleUploadIncoming('view');
        hfField.PerformCallback('cancel;' + transIDtoShow);
    }


    function selectEmployeeOnGrid() 
    {
        if (activeBteType != null || activeBteType != '') {
            if (!rowsSelected) {

                if (hfField.Contains(activeBteType)) {
                    var employees = hfField.Get(activeBteType).split(';');

                    grdEmployee.SelectRowsByKey(employees, true);

                    rowsSelected = true;
                }
            }
        }

    }
    function onLinkOutgoingUpdate(s, e) {
        var link = hfEdit.Get('uncLink');
        if (link != null || link != undefined) {
            var frame = document.getElementById('frDocOutgoing');
            //alert(link);
            frame.src = link;
        }
    }
    function OnLinkIncomingUpdated(s, e) {
        var link = hfField.Get('uncLink');


        if (link != null || link != undefined) {

            var frame = document.getElementById('frDoc');
            //alert(link);
            frame.src = link;
        }
    }
</script>
</asp:Content>